package com.kuangstudy.io.demo;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * ClassName: Demo13
 * date: 2021/07/16 14:52:44
 *
 * @author zlk
 */
public class Demo13 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("e:\\1.jpg");
        FileOutputStream fos = new FileOutputStream("d:\\1.jpg");
        int len = 0;//每次读取有效字节个数
        byte[] bytes = new byte[1024];
        while ((len = fis.read(bytes)) != -1) {
            fos.write(bytes,0,len);
        }
        /*先关闭写的 在关闭读的*/
        fos.close();
        fis.close();
    }
}
